# all: do all
all: clean prepare copy package cleanup

# clean: remove temp directory
clean:
	rm -rf temp

# prepare tree: copy binaries, create MD5 hashes
prepare: 
	cp ../src/bin/Release/LastFmUriHandler.exe lastfmsqueezeboxbridge/usr/lib/lastfmsqueezeboxbridge
	md5sum lastfmsqueezeboxbridge/usr/bin/lastfmsqueezeboxbridge > lastfmsqueezeboxbridge/DEBIAN/md5sums
	md5sum lastfmsqueezeboxbridge/usr/lib/lastfmsqueezeboxbridge/LastFmUriHandler.exe >> lastfmsqueezeboxbridge/DEBIAN/md5sums

# copy tree
copy: 
	cp -r lastfmsqueezeboxbridge temp
	# remove .svn directories
	rm -rf `find temp -type d -name .svn`
	chmod -R g+wr temp/	

# build package
package: 
	dpkg-deb --build temp
	mv temp.deb lastfmsqueezeboxbridge.deb 

# cleanup: remove temp
cleanup:
	rm -rf temp
